package com.czh.subject.infra.basic.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

import com.czh.subject.infra.basic.mapper.SubjectRadioMapper;
import com.czh.subject.infra.basic.entity.SubjectRadio;
import com.czh.subject.infra.basic.service.SubjectRadioService;
import org.springframework.stereotype.Service;

import java.util.List;
import lombok.RequiredArgsConstructor;

/**
 * 单选题信息表(SubjectRadio)表服务实现类
 *
 * @author caozaihui
 * @since 2024-07-31 00:16:05
 */
@Service("subjectRadioService")
@RequiredArgsConstructor
public class SubjectRadioServiceImpl extends ServiceImpl<SubjectRadioMapper, SubjectRadio> implements SubjectRadioService {
       
       private final SubjectRadioMapper subjectRadioMapper;
        /** 
         * 
         * @param  id 主键
         * @author caozaihui  
         * @description //TODO  通过ID查询单条数据
         * @date 2024-07-31 00:16:05
         * @return 实例对象
         */
        @Override
        public SubjectRadio selectSubjectRadioById (Long id) {
                LambdaQueryWrapper<SubjectRadio> subjectRadiolam =  new LambdaQueryWrapper<SubjectRadio>();
                subjectRadiolam.eq(SubjectRadio ::getId ,id);
                return baseMapper.selectOne(subjectRadiolam);
        }
        
        /**
         * @param subjectRadio 实例对象
         * @return 实例对象
         * @author caozaihui
         * @description //TODO  分页查询数据
         * @date 2024-07-31 00:16:05
         */
        @Override
        public List<SubjectRadio> querySubjectRadioList(SubjectRadio subjectRadio) {
            return this.subjectRadioMapper.selectSubjectRadioList(subjectRadio);     
        }
        
        /** 
         * 
         * @param subjectRadio 实例对象
         * @author caozaihui  
         * @description //TODO  新增数据
         * @date 2024-07-31 00:16:05
         * @return 实例对象
         */
        @Override
        public int insert(SubjectRadio subjectRadio) {
               return baseMapper.insert(subjectRadio);
        }
        
        
        /** 
         * 
         * @param subjectRadio 实例对象
         * @author caozaihui  
         * @description //TODO  修改数据并返回
         * @date 2024-07-31 00:16:05
         * @return 实例对象
         */
        @Override
        public int update(SubjectRadio subjectRadio) {
                return  baseMapper.updateById(subjectRadio);
        }
        
        
        /**
         *
         * @param idList 主键
         * @author caozaihui 
         * @description //TODO    通过主键删除数据
         * @date 2024-07-31 00:16:05
         * @return
         */
        @Override
        public int deleteById(List<Long> idList) {
            return baseMapper.deleteByIds(idList);
        }

    @Override
    public boolean batchInsert(List<SubjectRadio> subjectRadioList) {
        return baseMapper.insert(subjectRadioList).size()>0;
    }
}

